
// 完全二叉树
struct Node* connect(struct Node* root) {
    if (root == NULL) return NULL;
    struct Node *left = root->left;
    struct Node *right = root->right;

    while (left) {  //先连接中间
        left->next = right;
        left = left->right;
        right = right->left;
    }
    connect(root->left);
    connect(root->right);
    return root;
}